wdata_compute_size(writer_data_t* data)
{
queue* elem, *tmp;
- int res;
+ int res = 0;
+
+ if (QUEUE_EMPTY(&data->Q))
+ goto skip_empty_block; /* do not issue an empty block */
res = 23; /* bounds, ... of tag 0x80008 */
}
}
+skip_empty_block:
+
if (data->top_left) {
res += wdata_compute_size(data->top_left);
}
data->sz = res;
+ if (QUEUE_EMPTY(&data->Q))
+ return res;
+
return res + 12; /* + 12 = caller needs info about tag header size */
}
{
queue* elem, *tmp;
+ if (QUEUE_EMPTY(&data->Q))
+ goto skip_empty_block; /* do not issue an empty block */
+
gbfputint32(0x80008, fout);
gbfputint32(data->sz, fout);
gbfputint32(23, fout); /* bounds + three bytes */
}
}
+skip_empty_block:
+
if (data->top_left) {
wdata_write(data->top_left);
}